Travis CI

  • What is Travis? Is this a person? Why is everyone talking about Travis???

  • Have you ever heard someone say that they used Travis to test their package? Who is this amazing code guru?!

Allow me to introduce you

  • Turns out Travis is not a person after all, although there is a pretty awesome mascot that looks like a person.

  • Check here if you want to know more about why Travis is called Travis

What Travis CI really is…

  • This was actually a company in Berlin, Germany that was founded in 2001 that was recently acquired by Idera.

  • It is really a Continuous Integration and Continuous Deployment platform.

What is Continuous Integration?

*like pushing your code to the master branch on github regularly

How Continuous Integration works?

  • Typically programmers build their code and complete tests on their code before they commit

  • Build meaning: “the process of converting the human-readable source artifacts into machine-readable artifacts” according to users on stackoverflow
    • rendering
    • generating reports
    • compilation etc.

                 ***Travis helps automate this process***

What is Continuous Delivery / Deployment?

  • Basically you are getting your code ready to be deployed at all times - ie it can build without issues.

  • Travis-CI can directly link to github - thus it can also deliver or deploy websites of your code through github/github pages. We will talk more about that later.

https://blog.travis-ci.com/2019-05-30-setting-up-a-ci-cd-process-on-github

How Travis works

ref

How Travis works

  • travis-build uses the .travis.yml file that must be in your root project directory to create a bash script to run be run in the build environment by travis-worker

ref

Does Travis also work on private repos?

Yes, Travis CI works on private and public projects!

Lets add Travis to our repos!:

How do we do this? step 1: sign up/sign in to travis-ci

How do we do this? step2: activate github repos

Organization repo activation

How do we do this? step 3: create a .travis.yml file

Commit and push to github!!

For more details on what to include see here and here.

Our .travis.yml file for our repo that doesn’t have a package

Our DESCRIPTION file

  • In our case we are adding travis to repos that are not packages
  • But we still need to have a description file with info about our dependencies, authors, etc. even if just placeholders

Add github package dependencies

Manually add a field called “Remotes” specifying where the package is on github

Add Travis badge

  1. Go to the desired activated repository where you added .travis.yml and/or DESCRIPTION files
  2. Click the build gray button
  3. Select Markdown format
  4. Copy and paste the result into your README file

Trouble shooting

  • If your repo fails, you can modify your files and then run the test again.
  • Look at your errors to see what went wrong.

If Travis didn’t seem to run a build - check requests for more information.

pkgdown

Go to github repo settings and select the desired branch as source

Create _pkgdown.yml and if you haven’t yet and a .Rbuildignore file

Build and check your website

  • Commit and push all your changes!

  • Your website URL is the one listed in your github settings

  • For more info check here.

Additional Info

  • The wikipedia page has additional information on Travis CI in general.

  • This link will tell you more about how Travis CI works.

  • Remember you can use the usethis package to easily use pkgdown and travis for a package. This did not work as easily in our case as we were adding Travis CI and pkgdown to repos without a package. Here is a great tutorial.

  • Here is a list of common build problems.